var prefix = ctx + "admin/dept";
var listData = []

$(function() {
	listData = []
	var options = {
		code : "deptId",
		parentCode : "parentId",
		uniqueId : "deptId",
		rootIdValue : rootValue,
		expandAll : false,
		expandFirst : false,
		url : prefix + "/list",
		createUrl: prefix + "/goEditDept",
		updateUrl: prefix + "/goEditDept",
        removeUrl: prefix + "/{id}",
		modalName : "部门",
		columns : [
				{
					field : 'selectItem',
					radio : true
				},
				{
					title : '部门名称',
					field : 'name',
					width : '20%'
				},
				{
					title : '部门编码',
					field : 'deptCode',
					width : '20%'
				},
				{
					field : 'sort',
					title : '排序',
					width : '20%',
					align : "left"
				},
				{
					field : 'createTime',
					title : '创建时间',
					width : '20%',
					align : "left"
				},
				{
					title : '操作',
					width : '20%',
					align : "left",
					formatter: function(value, row, index) {
		                var actions = [];		                
		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                actions.push('<a class="btn btn-danger btn-xs ' + deleteFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.deptId + '\')"><i class="fa fa-trash"></i>删除</a>');		                
		                return actions.join('');
		            }
				} ]
	};
	$.treeTable.init(options);
	
});
